<?php
class Configure {
	protected static $loadPath = APPWEBROOT; 
	public function __construct() { 		
		$this->_setControllerPath();
	}
	public static function setLoadPath($path) {
		self::$loadPath = $path;	
	}
	public static function getLoadPath() {
		$boost = explode(".", HTTP_HOST);
		$root  = $boost[0];
		if (in_array($root, array(APPWEBROOT, APIWEBROOT))) {
			return $root;
		}
		return self::$loadPath;
	}
	private function _setControllerPath() {
		$_app  = self::getLoadPath();
		$_base = APP_PATH.$_app.DS;
		$_path = $_base.FOLDER_CTL.DS;
		$_view_path = $_base.FOLDER_TPL.DS;
		$_comp_path = $_base.FOLDER_TPC.DS;

		Common::recursiveMkdir($_comp_path);

		define('CTL_PATH',$_path);
		define('TPL_PATH',$_view_path);
		define('TPC_PATH',$_comp_path);
	}
}
?>